<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var str='abc 123 def';
        var arr=str.split(' ');  //split用法，就是将字符串分割成数组
        alert(arr.length);
        alert(arr);
    </script>
</head>
<body>

</body>
</html>